#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QTcpServer>
#include <QTcpSocket>
#include <QVector>
#include <QTreeView>
#include <QFileSystemModel>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNode>
#include <QTreeWidget>
#include <QByteArray>

#include "Interface/PluginInterface/tecplugininterface.h"
#include "Interface/PluginInterface/kukateplugininterface.h"

#include "uniontecsystemdll_global.h"
#include "WorkThreadManage/BackTcpThreadManage.h"
#include "WorkThreadManage/BackUdpThreadManage.h"

namespace Ui { class MainWindow; }

class HmiLocalThread : public QMainWindow{
    Q_OBJECT
public:
    explicit HmiLocalThread(QWidget *parent = 0);
    ~HmiLocalThread();
private:
    Ui::MainWindow *ui;
    QTimer *HmiFastTimer;
    QTimer *HmiSlowTimer;
    QVector<QString> NormalMessage;
    QVector<QString> WarningMessage;
    QVector<QString> ErrorMessage;
    MessageNumber    mMessageNumber;
    bool   RunLed;
    bool   PluginLogOut;
    tecPluginInterface* ptecPluginInstance = nullptr;
    kukatecPluginInterface* pkukatecPluginInstance = nullptr;
public:
    BackTcpThread*   pBackTcpThread;
    BackUdpThread*   pBackUdpThread;
public:
    short MainWindowInit();
    short MainWindowShow();
    short MainWindowHide();

    short Adminshow();

    short WriteMessageBox(MessageType Type,const QString Data);
    short WriteProgressBar(const int value);
public:
    short PluginInstanceConnect(tecPluginInterface* p);
    short KUKAPluginInstanceConnect(kukatecPluginInterface* p);
    short PluginInstanceLogOut();
private:
    short HmiTimerInit();
    short HmiTimerRelease();
    short HmiTimerStart();
    short HmiMessageBoxShow();
    short SignalSlotConnect();
public slots:
    void FastTimerUpdate();
    void SlowTimerUpdate();
    void onbtnclicked_MessageDetail();
    void onbtnclicked_AdvancedSetting();
    void onbtnclicked_MessageDone();
    void onbtnclicked_MessageAllDone();
};

#endif // MAINWINDOW_H
